<%--
  Created by IntelliJ IDEA.
  User: 13585
  Date: 2020/12/23
  Time: 21:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="${pageContext.request.getContextPath()}/back/layui/css/layui.css">
    <link rel="stylesheet" href="${pageContext.request.getContextPath()}/back/css/index.css">
</head>
<body>
<div id="login">
    <c:if test="${!empty msg}">
        <div id="prompt">
            <span>${msg}</span>
            <button class="determine" onclick="changeDis()">确定</button>
        </div>
    </c:if>
    <script>
        function changeDis() {
            let msg = document.getElementById("prompt");
            msg.style.display = "none";
        }
    </script>
    <form class="layui-form" action="updateAdmin" method="post" onsubmit="return checkReg()">
        <div class="container">
            <button class="close" title="关闭">X</button>
            <div class="layui-form-item">
                <label class="layui-form-label">用户名</label>
                <div class="layui-input-block">
                    <input type="text" name="username" value="${admin.username}" disabled class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">新密码</label>
                <div class="layui-input-inline">
                    <input id="inputPassword1" type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">确认密码</label>
                <div class="layui-input-inline">
                    <input id="inputPassword2" type="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">登陆</button>
                </div>
            </div>
            <%--        <a href="" class="font-set">忘记密码?</a>  <a href="" class="font-set">立即注册</a>--%>
        </div>
    </form>
</div>

<script type="text/javascript" src="${pageContext.request.getContextPath()}/back/layui/layui.js"></script>
<script>
    function checkReg() {
        let firstpassword = document.getElementById("inputPassword1").value;
        let lastpassword = document.getElementById("inputPassword2").value;
        if(firstpassword != lastpassword ){
            alert("两次密码不一样");
            return false;
        }else {
            return true;
        }
    }
</script>
</body>
</html>
